package restaurant;

import restaurant.iterators.Iterator;

/**
 * The Class cmdAssignedTables.
 * 
 * @author
 */

public class cmdAssignedTables implements Command
{

	/** The info. */
	private InformationAggregator info;



	/**
	 * Instantiates a new cmd used tables.
	 * 
	 * @param info the info
	 */
	public cmdAssignedTables(InformationAggregator info) {
		this.info = info;
	}



	/**
	 * Execute.
	 * 
	 * @return the object
	 * @see restaurant.Command#execute()
	 */
	@Override
	public Object execute()
	{
		Tables tables = info.getTables();
		Iterator it = tables.getAssignedTablesIterator();
		Tables assigned = new Tables();
		Table t;

		while (it.hasNext()) {
			t = (Table) it.next();
			assigned.add(t);
		}

		return assigned;
	}

}
